import Taro from "@tarojs/taro";
import {View} from "@tarojs/components";
import {useEffect, useRef} from "react";
import {Tab, Tabs} from "@antmjs/vantui";
import Book_list from "@/pages/order/book_list";
import Utils from "@/utils/common";


definePageConfig({
  navigationBarTitleText: '预约列表'
})


export default function Order() {

  //全部 待确认 待收样 进行中 待支付(检测完成，待支付)
  const tabs = useRef([
    {
      title: '全部',
      key: 0
    },
    {
      title: '待确认',
      key: 1
    },
    {
      title: '待收样',
      key: 2
    },
    {
      title: '进行中',
      key: 3
    },
    {
      title: '待支付',
      key: 4
    },
    {
      title: '已完结',
      key: 5
    }
  ]);

  useEffect(() => {
    const router = Taro.getCurrentInstance().router
    if (router) {
      // const params = Utils.getParamsWithUrl(router.params)
      // if(params.title){
      //   Utils.setTitle(`${params.title}预约列表`)
      // }
    }
  }, []);

  return (
    <View>
      <Tabs
        active={0}
        sticky
        swipeThreshold={6}
        color='#56abe4'
      >
        {
          tabs.current.map((item, index) => (
            <Tab key={`tabs#demo1${index}`} title={item.title}>
              <View>
                <Book_list item={item.title}></Book_list>
              </View>
            </Tab>
          ))
        }
      </Tabs>
    </View>
  )
}


